// 环境IP地址
const IP = 'localhost';
const GATEWAY_HOST = `http://${IP}:5100`;
const SEARCH_SERVER = `http://${IP}:5600`;
const SOCKET_SERVER = `ws://${IP}:5700`;
const MINIO_HOST = `http://192.168.75.77:9001/mylesson/`;
const MINIO_AVATAR = MINIO_HOST + '/avatar/';
const MINIO_BANNER = MINIO_HOST + '/banner/';
const MINIO_COURSE_COVER = MINIO_HOST + '/course-cover/';
const MINIO_COURSE_SUMMARY = MINIO_HOST + '/course-summary/';
const MINIO_EPISODE_VIDEO = MINIO_HOST + '/episode-video/';
const MINIO_EPISODE_VIDEO_COVER = MINIO_HOST + '/episode-video-cover/';
const UPLOAD_AVATAR_URL = GATEWAY_HOST + '/user-server/api/v1/user/uploadAvatar/';

// 常用请求状态码
export const STATUS = {
    "SUCCESS": 200,
    "FAILED": 500,
    "BAD_PARAM": 400,
    "VALIDATE_FAILED": 403,
    "METHOD_NOT_ALLOW": 405,
    "TOKEN_FAILED": 1001,
    "TOKEN_EXPIRING_SOON": 1002
}

// 常用表单规则
export const RULE = {
    'TITLE': [{
        pattern: /^.{1,42}$/,
        message: '标题长度必须在1~42之间'
    }],
    'AUTHOR': [{
        pattern: /^.{1,42}$/,
        message: '作者名称长度必须在1~42之间'
    }],
    'CODE': [{
        pattern: /^.{1,42}$/,
        message: '兑换口令长度必须在1~42之间'
    }],
    'SN': [{
        pattern: /^.{1,42}$/,
        message: '订单编号长度必须在1~42之间'
    }],
    'INFO': [{
        pattern: /^.{1,170}$/,
        message: '描述长度必须在1~170之间'
    }],
    'CONTENT': [{
        pattern: /^.{1,170}$/,
        message: '内容长度必须在1~170之间'
    }],
    'MENU_URL': [{
        pattern: /^\/[a-zA-Z]{0,256}$/,
        message: '跳转地址必须以 / 开头，后续内容仅支持0~256个英文字母'
    }],
    'MENU_ICON': [{
        pattern: /^[a-zA-Z]{1,256}$/,
        message: '图标仅支持1~256个英文字母'
    }],
    'USERNAME': [{
        pattern: /^[a-zA-Z0-9]{4,20}$/,
        message: '账号必须由4到20个英文字母或数字组成'
    }],
    'NICKNAME': [{
        pattern: /^[\u4e00-\u9fa5|_a-zA-Z0-9]{4,10}$/,
        message: '昵称必须由4到10个中文，英文字母，数字或下划线组成'
    }],
    'PASSWORD': [{
        pattern: /^[a-zA-Z0-9]{4,20}$/,
        message: '密码必须由4到20个英文字母或数字组成'
    }],
    'REALNAME': [{
        pattern: /^[\u4e00-\u9fa5]{2,6}$/,
        message: '真实姓名必须由2到6个中文组成'
    }],
    'IDCARD': [{
        pattern: /^[1-9]\d{5}(19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
        message: '身份证号格式不正确'
    }],
    'PHONE': [{
        pattern: /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/,
        message: '手机号码格式不正确'
    }],
    'EMAIL': [{
        pattern: /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/,
        message: '电子邮箱格式不正确'
    }],
    'ZODIAC': [{
        pattern: /^[\u4e00-\u9fa5]{2,4}$/,
        message: '星座必须由2到4个中文组成'
    }],
    'PROVINCE': [{
        pattern: /^[\u4e00-\u9fa5]{2,20}$/,
        message: '省份必须由2到20个中文组成'
    }],
    'VCODE': [{
        pattern: /^\d{6}$/,
        message: '验证码必须为6位数字'
    }],
}

// 项目大标题
const PROJECT_TITLE = '绝对精品课 - 我的课堂';

// 项目小标题
const PROJECT_SUB_TITLE = 'Welcome To Lesson Project';

// 导出模块
module.exports = {
    GATEWAY_HOST, SEARCH_SERVER, SOCKET_SERVER, STATUS, RULE,
    MINIO_AVATAR, MINIO_BANNER, MINIO_COURSE_COVER, MINIO_COURSE_SUMMARY,
    MINIO_EPISODE_VIDEO, MINIO_EPISODE_VIDEO_COVER, UPLOAD_AVATAR_URL,
    PROJECT_TITLE, PROJECT_SUB_TITLE
}